export default class Myevent{
    constructor (){
        this.evobj = {};
    }
    addEvent(eventName,fn){
    if(typeof this.evobj[eventName] === 'undefined'){
        this.evobj[eventName] = [];
    }
    this.evobj[eventName].push(fn);
 }
    trigger(eventName){
    if(typeof this.evobj[eventName] !== 'undfiend'){
        this.evobj[eventName].forEach(fn=>{
            fn();
        })
    }else{
        throw Error('参数错误');
    }        
}
}